from PageUnit import PageUnitSrv
import sys,time
list=[]
a=PageUnitSrv()
a.setStocks(('2382','5009','2356'))
a.start()
while (1):
	time.sleep(1)
	if a.checkDone():
		break;
sys.exit()
def ryaninfo(info):
	print info
	return info

for i in ("2382","5009"):
	a=pageunit()
	a.setURL(StkNo=i)
	a.setProcFunc(ryaninfo,"hello")
	a.start()
	list.append(a)

Num=0	
while(1):
	for a in list:
		if a.getAck():
			Num +=1
			print a, a.getData()[0]
		#else:
			#a.setPaserFunc=ryaninfo
			#a.setPaserFunc("Hello World")
	if Num ==2:
		break
	else: 
		Num=0
	import time
	time.sleep(1)
sys.exit()
"""

for i in range(1):
	a=list.pop(0)
	print a
	#a.getPage(2382)
"""
